package com.decent.manager.task.service.impl;

import com.decent.manager.system.dao.SystemOrderDao;
import com.decent.manager.task.service.OrderTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * @author: decent Gjh
 * @date: 2022/11/03/11:29
 * @description:
 */
@Service
@Slf4j
public class OrderTaskServiceImpl implements OrderTaskService {
    private final SystemOrderDao orderDao;

    public OrderTaskServiceImpl(SystemOrderDao orderDao) {
        this.orderDao = orderDao;
    }

    /**
     * 关闭超时订单
     */
    @Override
    public void closeOrder() {
        int i = orderDao.closeOvertimeOrders(LocalDateTime.now().minusMinutes(5));
        log.info("关闭"+i+"笔订单");
    }
}
